package com.api.rest.web.view;

import com.mms.utils.XmlConvertUtils;
import org.springframework.web.servlet.view.AbstractView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Map;

/**
 * Created by dan3652@sina.com on 2016-12-02 10:58.
 */
public class MappingXmlView extends AbstractView {
    public MappingXmlView() {
    }

    protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception {
        response.setContentType(this.getContentType());
        response.getWriter().write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + XmlConvertUtils.maptoXml(model).asXML());
    }
}
